package com.feynman.pattern.singleton.hungry;

/**
 * @ClassName HungrySingleton
 * @Description 饿汉模式单例
 * @Author Feynman
 * @date 2019/4/4 16:56
 * @Version V1.0
 **/
public class HungryStaticSingleton {

    private static HungryStaticSingleton hungryStaticSingleton = null;

    //静态代码块 类里面加载顺序是先静态 后动态 先属性 后方法
    static {
        hungryStaticSingleton = new HungryStaticSingleton();
    }

    private HungryStaticSingleton(){

    }
    public static HungryStaticSingleton getInstance(){
        return  hungryStaticSingleton;
    }

}
